//子项目展示js
var $dataTable;
function deleteCompany(id) {
	if (id == null) {
		alert('id为空');
		return;
	}
	if (confirm('确定删除该机构信息吗?')) {
		var param = {};
		param.id = id;
		postContent("/company/delete", param, true, function(data) {
			if (data != null) {
				alert('删除成功!');
				$dataTable.ajax.reload();
			}
		});
	}
}

function modiCompany(id) {
	var param = {};
	param.id = id;
	showContent('/view/company-create.html',param,createCompanyInit);
}


function showCompanyInit() {
	$dataTable = $('#option')
			.DataTable(
					getCommonPageParam(
							"/company/showPage",
							{},
							true,
							[ {
								"mData" : "name"
							}, {
								"mData" : "typeStr"
							}, {
								"mData" : "operation"
							} ],
							function(resp) {
								var data = resp.aaData;
								for (num in data) {
									var id = data[num].id;
									data[num].name = '<a href="#" onclick=modiCompany('
											+ id 
											+ ')>'
											+ data[num].name
											+ '</a>';
									data[num].operation = '<a href="#" onclick=deleteCompany('
											+ id + ')>删除</a>';
								}
								return resp;
							}));
}